# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=kvirc
pkgver=5.0.0
pkgrel=8
pkgdesc='Qt based IRC client'
arch=('loong64' 'x86_64')
url='http://kvirc.net/'
license=('GPL2')
depends=('enchant' 'hicolor-icon-theme' 'qt5-multimedia' 'qt5-svg' 'qt5-x11extras')
makedepends=('cmake' 'ninja' 'python')
optdepends=('perl: scripting support'
            'python: scripting support')
source=("ftp://ftp.kvirc.net/pub/kvirc/$pkgver/source/KVIrc-$pkgver.tar.bz2"
        'kvirc.appdata.xml'
        'python3.patch'
        'qt5.15.patch')
sha256sums=('76cd4cdcaca5e4056f086cdcbb6122c2ca7e331d6e66c7ebc57d32565f626a65'
            '433c6b2d36479ae2c4a0342dc9750ba79ffd9f4fa479f28740cd1c4303bc71da'
            'dfa8586a849b1c74280b4203b45c24d3e9ad1f184ba09fe16c59febb64b1ca79'
            '06c5df4fa2fded8b686beddf6824ff655aa6cd2164b1e8b07100418563d02e4e')

prepare() {
  cd KVIrc-$pkgver
  patch -Np1 -i ../python3.patch
  patch -Np1 -i ../qt5.15.patch
}

build() {
  cmake -S KVIrc-$pkgver -B build -G Ninja -DCMAKE_INSTALL_PREFIX='/usr' \
    -DCMAKE_SKIP_RPATH=YES \
    -DWANT_QTWEBKIT=OFF \
    -DWANT_KDE=OFF \
    -DWANT_PHONON=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 $pkgname.appdata.xml "$pkgdir/usr/share/metainfo/$pkgname.appdata.xml"
}
